package com.liveinstars.api.im;

import com.liveinstars.api.im.vo.ChatGroupDetailVO;
import com.liveinstars.api.im.vo.ChatGroupRecordVO;
import com.liveinstars.api.im.query.ChatGroupQuery;
import com.liveinstars.api.im.vo.ChatMsgVO;
import com.liveinstars.api.im.vo.WordVO;
import com.onepiece.shipelves.common.Result;
import com.onepiece.shipelves.common.vo.Page;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: ting
 * @date: 2020/3/6
 */
@FeignClient("im")
public interface ChatGroupApi {

    /**
     * 圈子管理列表分页查询接口
     * @param query
     * @return
     */
    @PostMapping("/chatGroup/pageBackendRecordByQuery")
    Result<Page<ChatGroupRecordVO>> pageBackendRecordByQuery(@RequestBody ChatGroupQuery query);

    /**
     * 获取分页圈子列表
     * @param query
     * @return
     */
    @PostMapping("/chatGroup/pageByQuery")
    Result<Page<ChatGroupRecordVO>> pageByQuery(@RequestBody ChatGroupQuery query);

    /**
     * 获取圈子详情
     * @param id
     * @return
     */
    @GetMapping("/chatGroup/getDetailById")
    Result<ChatGroupDetailVO> getDetailById(@RequestParam("id")Long id);

    /**
     * 根据id更新数据群组信息
     * @param vo
     */
    @PostMapping("/chatGroup/updateById")
    Result updateById(@RequestBody ChatGroupDetailVO vo);

    /**
     * 根据id更新hot值
     * @param id
     * @param hot
     */
    @PostMapping("/chatGroup/updateHotById")
    Result updateHotById(@RequestParam("id")Long id, @RequestParam("hot")Integer hot);

    /**
     * 根据圈子id分页查询群组消息列表
     * @param id
     * @param pageSize
     * @param pageNum
     * @return
     */
    @GetMapping("/chatGroup/pageChatMsgByChatGroupId")
    Result<Page<ChatMsgVO>> pageChatMsgByChatGroupId(@RequestParam("id")Long id,
                                                     @RequestParam(value = "page_size", defaultValue = "15") Integer pageSize,
                                                     @RequestParam(value = "page_num", defaultValue = "1") Integer pageNum);

    /**
     * 根据群id和消息id删除消息
     * @param chatGroupId
     * @param msgId
     * @return
     */
    @GetMapping("/chatGroup/deleteMsgByChatGroupIdAndMsgId")
    Result deleteByChatGroupIdAndMsgId(@RequestParam("chat_group_id") Long chatGroupId, @RequestParam("msg_id") Long msgId);

    /**
     * 后台解散群
     * @param chatGroupId
     * @return
     */
    @PostMapping("/chatGroup/disbandChatGroupByBackend")
    Result disbandChatGroupByBackend(@RequestParam("chat_group_id")Long chatGroupId);

    /**
     * 获取用户创建的圈子列表
     * @param userId
     * @return
     */
    @GetMapping("/chatGroup/listChatGroupByCreateUserId")
    Result<List<ChatGroupRecordVO>> listChatGroupByCreateUserId(@RequestParam("user_id") Long userId);

    /**
     * 修改群成员备注名称
     * @param selfId
     * @param chatGroupId
     * @param remarkName
     * @return
     */
    @PutMapping("/chatGroup/updateMemberRemarkName")
    Result updateMemberRemarkName(@RequestHeader("uid")Long selfId,
                                  @RequestParam("chat_group_id")Long chatGroupId,
                                  @RequestParam("remark_name")String remarkName);

    @GetMapping("/chatGroup/listChatGroupByCreateUserIdAndInterestId")
    Result<List<ChatGroupRecordVO>> listChatGroupByCreateUserIdAndInterestId(@RequestParam("user_id") Long userId, @RequestParam("interest_id") Integer interestId);

    @GetMapping("/chatGroup/getChatGroupByCreateUserIdAndInterestId")
    ChatGroupRecordVO getChatGroupByCreateUserIdAndInterestId(@RequestParam("user_id") Long userId, @RequestParam("interest_id") Integer interestId);

    @GetMapping("/chatGroup/addChatGroupMember")
    boolean addChatGroupMember(@RequestParam("user_id") Long userId, @RequestParam("group_id") Long groupId);

//    /**
//     * 给内容打分
//     * @return
//     */
//    @PostMapping("/chatGroup/scoreContent")
//    int scoreContent(@RequestBody WordVO wordVO);

}
